//
//  SQSpecialViewController.m
//  energy
//
//  Created by 周曼迪 on 2021/7/14.
//

#import "SQSpecialViewController.h"

#import "SQSpecialodel.h"

#import "SQWorkDetailsViewController.h"

@interface SQSpecialViewController ()<BaseTableVCInterface>

@end

@implementation SQSpecialViewController

- (void)viewDidLoad {
    self.tableViewInterface = self;
    [super viewDidLoad];
    self.navigationItem.title = @"专项检查";
    
    [self getSpecialData];
    
    self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
        [self getSpecialData];
    }];
    LC_WEAK_SELF
    self.cellEvent = ^(int key) {
        SQSpecialodelData * dataModel = weakSelf.dataSouece[key];
        SQWorkDetailsViewController * workDetailsVC = SQWorkDetailsViewController.new;
        workDetailsVC.detailsID = dataModel.sa_id;
        workDetailsVC.sa_sc = dataModel.sa_sc;
        
        workDetailsVC.type = @"2";
        [weakSelf pushVC:workDetailsVC];
       
    };
    
}

-(void)getSpecialData{
    
    [SQSpecialodel getDataWithParams:@{@"m_id":UID,@"sa_enterprise":MEnterpriseId} WithCallBack:^(SQSpecialodel * data) {
        
        [self detailModelwithArr:data.data withCallBack:nil];
        [self reloadTableView];
        
    }];
}


-(NSInteger)rowsCount:(NSInteger)section{
    
    return self.dataSouece.count;
}

-(BaseModel *)modelForCell:(NSIndexPath *)indexPath{
    
    return self.dataSouece[indexPath.row];
}



    
- (NSArray<NSArray<NSString *> *> *)classArr{
        NSMutableArray *arr = @[].mutableCopy;
        
        for (SQSpecialodelData * dataModel in self.dataSouece) {
            if ([dataModel.sa_inspection_frequency isEqualToString:@"0"]) {
               [arr addObject:@"SQSpecialSingleTableViewCell"];
                
            }else if ([dataModel.sa_inspection_frequency isEqualToString:@"1"]){
        
                [arr addObject:@"SQSpecialFixationTableViewCell"];
            }
        }
        
        
        return @[arr.copy];
    }




@end
